from django.urls import path
from meiduo_mall_admin.meiduo_admin.views import home, users, goods_image, sku_info, admin
from meiduo_mall_admin.meiduo_admin.views.login import admin_jwt_token
from rest_framework.routers import DefaultRouter, SimpleRouter

# from rest_framework_jwt.views import obtain_jwt_token

urlpatterns = [

  # path('meiduo_admin/authorizations/', obtain_jwt_token),
  path("meiduo_admin/authorizations/", admin_jwt_token),
  # -------------首页
  path('meiduo_admin/statistical/total_count/', home.UserCountView.as_view()),
  path('meiduo_admin/statistical/day_increment/', home.DayIncrementView.as_view()),
  path('meiduo_admin/statistical/day_active/', home.DayActiveView.as_view()),
  path('meiduo_admin/statistical/day_orders/', home.DayOrdersView.as_view()),
  path('meiduo_admin/statistical/month_increment/', home.MonthIncrementView.as_view()),

  # -------------用户管理
  path('meiduo_admin/users/', users.UserSearchView.as_view()),
  # --------------商品管理
  path('meiduo_admin/skus/simple/', goods_image.SKUIdListView.as_view()),
  # 新增商品获取商品分类
  path('meiduo_admin/skus/categories/', sku_info.SkuCategoriesView.as_view()),
  path('meiduo_admin/goods/simple/', sku_info.SpuSimpleView.as_view()),
  path('meiduo_admin/goods/<int:pk>/specs/', sku_info.SpuSpecsView.as_view()),

  #权限管理
  path('meiduo_admin/permission/content_types/', admin.PermissionTypeView.as_view()),
  path('meiduo_admin/permission/simple/', admin.PermissionListView.as_view()),
  path('meiduo_admin/permission/groups/simple/', admin.PermissionGroupListView.as_view()),





]
# --------------商品管理`
router = DefaultRouter()
# router = SimpleRouter()
router.register('meiduo_admin/skus/images', goods_image.SkuImagesView, basename='images')
router.register('meiduo_admin/skus', sku_info.SKUInfoView, basename='skuinfo')
router.register('meiduo_admin/permission/perms', admin.PermissionView, basename='permission')
router.register('meiduo_admin/permission/groups', admin.PermissionGroupView, basename='permission_group')
router.register('meiduo_admin/permission/admins', admin.PermissionAdminView, basename='permission_admin')

urlpatterns += router.urls
